from django.db.models import Q

from olympia.amo.management import ProcessObjectsCommand
from olympia.users.models import UserProfile
from olympia.users.tasks import restrict_banned_users


class Command(ProcessObjectsCommand):
    def get_model(self):
        return UserProfile

    def get_tasks(self):
        return {
            'restrict_banned_users': {
                'task': restrict_banned_users,
                'queryset_filters': [Q(banned__isnull=False)],
            }
        }
